<?php

class curl {

    private  $_ch;
    private static $_instance;

    public static function instance() {
        if (self::$_instance === null) {
            self::$_instance = new curl();
        }
        return self::$_instance;
    }
    
    public function __construct() {
        $this->_ch = curl_init();
    }

    public function get($url) {
        if (isset($url)) {
            
            curl_setopt_array($this->_ch, array(
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_TIMEOUT => 30,
                CURLOPT_URL => $url
            ));

            $resp = curl_exec($this->_ch);
            return $resp;
        }
    }

    public function close() {
        curl_close($this->_ch);
    }

}

?>
